objs := start.o main.o
target := led.bin
GNU := arm-linux-gnueabihf-
LD := $(GNU)ld
OBJCOPY := $(GNU)objcopy
OBJDUMP := $(GNU)objdump
CC := $(GNU)gcc

$(target):$(objs)
	$(LD) -Timx6ul.lds -o led.elf $^
	$(OBJCOPY) -O binary -S led.elf $@
	$(OBJDUMP) -D -m arm led.elf > led.dis

%.o:%.s
	$(CC) -Wall -nostdlib -c -o $@ $<

%.o:%.S
	$(CC) -Wall -nostdlib -c -o $@ $<

%.o:%.c
	$(CC) -Wall -nostdlib -c -o $@ $<

.PHONY:clean
clean:
	-rm -rf *.o *.bin *.elf *.dis
